// var arr2:number[] = new Array(1, 2, 3)
var arr2: any[] = new Array(1, 2, 3, 100, 200)
var arr3 = ["one", "two", "three"]

// 属性
console.log(arr3.length);

// 方法
// 如果都是any可以连接，如果指定了number 和 string则会编译报错
console.log(arr3.concat(arr2))

function bigNumber(val:number, index:number, array:number[]) {
    return val > 10;
}

var flag = [10, 11, 12, 123].every(bigNumber)
console.log("every is :" + flag)
// some指是否有至少一个符合条件，符合就true，否则false，every是指每一个
var flag2 = [10, 12].some(bigNumber);
console.log("some is :" + flag2)
console.log(arr2.filter(bigNumber))
arr2.forEach((val)=>console.log(val))

console.log(arr2.indexOf(100))
// 数子数组可以join吗
console.log(arr2.join(","))

console.log("match sqrt:"+ arr2.map(Math.sqrt))
console.log(arr2.pop())
console.log(arr2.push(300))
console.log(arr2.reverse())
console.log(arr2.reduce((a, b) => a + b))
console.log(arr2.reduceRight((a, b) => a + b))
// 删除并返回第一个数字
console.log(arr2.shift())
console.log(arr2.sort())
console.log(arr2.slice(1, 2))
// 删除的起点，数量和元素
console.log(arr2.splice(1, 1, 100))
// 开头添加元素
console.log(arr2.unshift(10000))
console.log(arr2.toString())


